home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / var / lib / dpkg / info / dictionaries-common.postinst < prev    next >
Text File  |  2008-06-04  |  4KB  |  97 lines

  1. #! /bin/sh
  2. # postinst script for dictionaries-common
  3.  
  4. set -e
  5.  
  6. # Sourcing debconf confmodule
  7. . /usr/share/debconf/confmodule
  8.  
  9. case "$1" in
  10.   configure)
  11.   # This will remove /usr/share/pspell/region-to-spelling.map diversion by
  12.   # dictionaries-common package and associated stuff if present
  13.     rm -f /var/cache/dictionaries-common/region-to-spelling.map
  14.  
  15.   # This next handles a bug in some dpkg versions not removing
  16.   # the symlink properly when upgrading
  17.     if [ -L /usr/share/pspell/region-to-spelling.map ]; then
  18.     RTS_DEST=`readlink /usr/share/pspell/region-to-spelling.map`
  19.     if [ "$RTS_DEST" = "/var/cache/dictionaries-common/region-to-spelling.map" ]; then
  20.         rm -f /usr/share/pspell/region-to-spelling.map
  21.     fi
  22.     fi
  23.  
  24.   # Removing the diversion if it still exists. trued just in case it does not,
  25.   # since grep returns error breaking postinst because of set -e otherwise.
  26.     DC_DIVERT=`dpkg-divert --list dictionaries-common | grep region-to-spelling.map` || true
  27.     if [ "$DC_DIVERT" ]; then
  28.     dpkg-divert --package  dictionaries-common --remove --rename \
  29.         --divert /usr/share/pspell/region-to-spelling.map.orig \
  30.         /usr/share/pspell/region-to-spelling.map
  31.     fi
  32.  
  33.     # We no longer create the /usr/dict symlink
  34.  
  35.     # This will check for obsolete /etc/dictionary link
  36.     if [ -L /etc/dictionary ]; then
  37.     db_get dictionaries-common/old_wordlist_link
  38.     if [ "$RET" = "true" ]; then
  39.         rm /etc/dictionary
  40.     fi
  41.     fi
  42.  
  43.     # Ensure that automatic generation of files is done, such that we always
  44.     # start with a sane environment
  45.     /usr/sbin/update-default-ispell     --rebuild
  46.     /usr/sbin/update-default-wordlist   --rebuild
  47.     /usr/sbin/update-dictcommon-aspell
  48.     /usr/sbin/update-openoffice-dicts
  49.  
  50.     # Remove obsolete jed startup file
  51.     if [ -f /etc/jed-init.d/50dictionaries-common.sl ] ; then
  52.         echo "Removing obsolete /etc/jed-init.d/50dictionaries-common.sl" >&2
  53.         rm -f /etc/jed-init.d/50dictionaries-common.sl
  54.     fi
  55.  
  56.     # That made this dir not be removed by dpkg. Remove it if exists, is non
  57.     # empty, and jed-common is not installed
  58.     if [ -d /etc/jed-init.d ] && [ ! -e /etc/jed-init.d/00debian.sl ]; then
  59.         rmdir --ignore-fail-on-non-empty /etc/jed-init.d
  60.     fi
  61.  
  62.     # ---------------- 8< ----------------------------------------------------
  63.     # Remove obsolete dictionaries-common.reconfiguring. This problem only
  64.     # lasted for two days and, so this should go away long before releasing lenny
  65.     if [ -f /var/cache/dictionaries-common/postinst.reconfiguring ] ; then
  66.         echo "Removing obsolete /var/cache/dictionaries-common/postinst.reconfiguring" >&2
  67.         rm -f /var/cache/dictionaries-common/postinst.reconfiguring
  68.     fi
  69.     # ---------------- 8< ----------------------------------------------------
  70.  
  71.     # Remove obsolete aspell-equivs file
  72.     if [ -f /var/cache/dictionaries-common/emacsen-aspell-equivs.el ] ; then
  73.         echo "Removing obsolete /var/cache/dictionaries-common/emacsen-aspell-equivs.el" >&2
  74.         rm -f /var/cache/dictionaries-common/emacsen-aspell-equivs.el
  75.     fi
  76.  
  77.   ;;
  78.  
  79.   abort-upgrade|abort-remove|abort-deconfigure)
  80.   ;;
  81.  
  82.   *)
  83.     echo "postinst called with unknown argument \`$1'" >&2
  84.     exit 0
  85.   ;;
  86. esac
  87.  
  88. # We need to test that there are emacsen installed before calling emacs-package-*
  89. if [ "$1" = "configure" ] && [ -x /usr/lib/emacsen-common/emacs-package-install ]
  90. then
  91.     [ -e /var/lib/emacsen-common/installed-flavors ] && /usr/lib/emacsen-common/emacs-package-install dictionaries-common
  92. fi
  93.  
  94.  
  95.  
  96. exit 0
  97.